home *** CD-ROM | disk | FTP | other *** search
/ Champak 86 / (Vol 86) My Disc.iso / Games / restaurante_1422.swf / scripts / __Packages / Main.as < prev   
Text File  |  2009-04-29  |  5KB  |  152 lines

  1. class Main extends MovieClip
  2. {
  3.    function Main()
  4.    {
  5.       super();
  6.       this.chrono = new Chrono();
  7.       this.start = false;
  8.       this.fin = false;
  9.       this.xTab = [null,55,185,313,443,570,699];
  10.    }
  11.    function ini()
  12.    {
  13.       this.cache_mc.onRollOver = function()
  14.       {
  15.          this.useHandCursor = false;
  16.       };
  17.       this.cache_mc._visible = false;
  18.       this.cadeau._visible = false;
  19.       this.gateaux = [1,2,3,4,5,6];
  20.       this.gateau1.recette = [18,5,9,22];
  21.       this.gateau1.url = "MissDecouverte_Recette_BoulesCoco.pdf";
  22.       this.gateau2.recette = [23,1,14,12,8,13,15];
  23.       this.gateau2.url = "MissDecouverte_Recette_Chouquettes.pdf";
  24.       this.gateau3.recette = [17,23,12,1,18,4,6,21,15,20];
  25.       this.gateau3.url = "MissDecouverte_Recette_TarteChocolatNoisettes.pdf";
  26.       this.gateau4.recette = [4,23,1,16,15,12,3,14,2,19];
  27.       this.gateau4.url = "MissDecouverte_Recette_CookiesCacaoPepitesChocolat.pdf";
  28.       this.gateau5.recette = [23,1,12,10,8,15,14];
  29.       this.gateau5.url = "MissDecouverte_Recette_BriochePurBeurre.pdf";
  30.       this.gateau6.recette = [23,10,15,8,11,7];
  31.       this.gateau6.url = "MissDecouverte_Recette_PainEpice.pdf";
  32.       this.cakeMaker();
  33.    }
  34.    function cacheCadeau()
  35.    {
  36.       this.cadeau._visible = false;
  37.       this.cadeau.gotoAndStop(1);
  38.    }
  39.    function restart()
  40.    {
  41.       this.gateaux = [1,2,3,4,5,6];
  42.       this.gateau1.recette = [18,5,9,22];
  43.       this.gateau2.recette = [23,1,14,12,8,13,15];
  44.       this.gateau3.recette = [17,23,12,1,18,4,6,21,15,20];
  45.       this.gateau4.recette = [4,23,1,16,15,12,3,14,2,19];
  46.       this.gateau5.recette = [23,1,12,10,8,15,14];
  47.       this.gateau6.recette = [23,10,15,8,11,7];
  48.       this.start = false;
  49.       this.cache_mc._visible = false;
  50.       if(this.fin)
  51.       {
  52.          this.cadeau.tween(["_y","_alpha"],[this.cadeau._y - 10,0],0.2,"easeOutQuad",0,mx.utils.Delegate.create(this,this.cacheCadeau));
  53.       }
  54.       this.fin = false;
  55.       this.panneau_mc.tween(["_y","_alpha"],[49,0],0.3,"easeOutQuad");
  56.       this.fake_mc.setMask(this.masque_mc);
  57.       var _loc2_ = 1;
  58.       while(_loc2_ <= 6)
  59.       {
  60.          if(this["gateau" + _loc2_].bt_mc._currentframe > 1)
  61.          {
  62.             this["gateau" + _loc2_].bt_mc.gotoAndPlay("close");
  63.          }
  64.          this["gateau" + _loc2_].brightnessTo(-80,0.3);
  65.          this["gateau" + _loc2_].start();
  66.          _loc2_ = _loc2_ + 1;
  67.       }
  68.       this.suivant();
  69.    }
  70.    function cakeMaker()
  71.    {
  72.       this.panneau_mc.gotoAndStop(6);
  73.       this.id = Math.floor(Math.random() * this.gateaux.length);
  74.       this.panneau_mc.gotoAndStop(this.gateaux[this.id]);
  75.       this.panneau_mc.stopTween();
  76.       this["gateau" + this.gateaux[this.id]].ini();
  77.       this.remplissage.gotoAndStop(1);
  78.       var _loc2_ = 1;
  79.       while(_loc2_ <= 15)
  80.       {
  81.          var _loc3_ = _loc2_ * 0.04;
  82.          this["ingredient" + _loc2_].anim_mc.gotoAndStop(1);
  83.          if(_loc2_ != 15)
  84.          {
  85.             this["ingredient" + _loc2_].alphaTo(100,0.2,"easeInExpo",_loc3_);
  86.          }
  87.          else
  88.          {
  89.             this["ingredient" + _loc2_].alphaTo(100,0.2,"easeInExpo",_loc3_,mx.utils.Delegate.create(this,this.affichage));
  90.          }
  91.          _loc2_ = _loc2_ + 1;
  92.       }
  93.    }
  94.    function affichage()
  95.    {
  96.       this.panneau_mc.tween(["_y","_alpha"],[59,100],0.3,"easeInQuad");
  97.       this.fleche_mc.tween("_x",this.xTab[this.gateaux[this.id]],0.5);
  98.       this["gateau" + this.gateaux[this.id]].brightnessTo(0,0.3);
  99.    }
  100.    function suivant()
  101.    {
  102.       var _loc2_ = 1;
  103.       while(_loc2_ <= 15)
  104.       {
  105.          var _loc3_ = _loc2_ * 0.03;
  106.          this["ingredient" + _loc2_].anim_mc.gotoAndStop(1);
  107.          if(_loc2_ != 15)
  108.          {
  109.             this["ingredient" + _loc2_].alphaTo(0,0.2,"easeInExpo",_loc3_);
  110.          }
  111.          else
  112.          {
  113.             this["ingredient" + _loc2_].alphaTo(0,0.2,"easeInExpo",_loc3_,mx.utils.Delegate.create(this,this.cakeMaker));
  114.          }
  115.          _loc2_ = _loc2_ + 1;
  116.       }
  117.    }
  118.    function win()
  119.    {
  120.       this.fin = true;
  121.       this.chrono.stop();
  122.       this.cache_mc._visible = true;
  123.       this.cadeau._visible = true;
  124.       this.cadeau.gotoAndStop(2);
  125.       this.cadeau._alpha = 0;
  126.       this.cadeau.tween(["_y","_alpha"],[this.cadeau._y + 10,100],1);
  127.       this.fleche_mc.tween("_x",800,0.5);
  128.       var _loc2_ = 1;
  129.       while(_loc2_ <= 6)
  130.       {
  131.          this.setCakeLink(this["gateau" + _loc2_].bt_mc);
  132.          this["gateau" + _loc2_].bt_mc.play();
  133.          _loc2_ = _loc2_ + 1;
  134.       }
  135.    }
  136.    function setCakeLink(mc)
  137.    {
  138.       mc.onRollOver = mc.onDragOver = function()
  139.       {
  140.          this.gotoAndPlay("over");
  141.       };
  142.       mc.onRollOut = mc.onDragOut = function()
  143.       {
  144.          this.gotoAndPlay("out");
  145.       };
  146.       mc.onRelease = function()
  147.       {
  148.          this.getURL("PDF/" + this._parent.url,"_blank");
  149.       };
  150.    }
  151. }
  152.